/**
 * 中间件： 就是处理过程中的一个环节
 */

 const express = require('express');
 const app = express();

let total = 0;

app.use((req, resp, next) => {
    console.log('有人访问...');
    next();
});

app.use('/user', (req, resp, next) => {
    console.log(Date.now());
    next();
});

app.use('/user', (req, resp, next) => {
    // 记录访问日志
    console.log("访问了/user");
    next();
});

app.use('/user', (req, resp, next) => {
    total++;
    console.log('total: ', total);
    resp.send('result');
});

app.listen(3000, () => {
    console.log('running...');
});
